package com.zhiy.com.estation.ui.fragment.register;

import com.zhiy.com.estation.api.ApiResult;

import io.reactivex.functions.Consumer;

/**
 * Created by Zyh on 2016/12/3.
 */
public class RegisterPresenter extends RegisterContract.Presenter  {
    @Override
    public void regist(String name, String password) {
        model.regist(name,password)
                .subscribe(new Consumer<ApiResult>() {
                    @Override
                    public void accept(ApiResult apiResult) throws Exception {
                        view.showMsg(apiResult.getMsg());
                        if (apiResult.getCode() == 0) {
                            view.isRegisterSuccess();
                        } else {
                            view.isFailure();
                        }
                    }
                });
    }
}
